//
//  SRHistoryChartView.m
//  SportRing
//
//  Created by mykoma on 14-6-11.
//  Copyright (c) 2014年 HotOne. All rights reserved.
//

#import "SRHistoryChartView.h"
#import "PNChart.h"

@interface SRHistoryChartView ()

@property (nonatomic, strong) PNLineChart * lineChart;

@end

@implementation SRHistoryChartView

-(void)setupViews
{
    self.lineChart = [[PNLineChart alloc] initWithFrame:self.bounds];
    [self addSubview:self.lineChart];
    
    [self.lineChart setXLabels:@[@"1",@"2",@"3",@"4",@"5"]];
    
    NSArray * data = @[@13,@5,@10,@4,@12];
    PNLineChartData * lineChartData = [[PNLineChartData alloc] init];
    lineChartData.color = [UIColor greenColor];
    lineChartData.itemCount = data.count;
    lineChartData.getData = ^(NSUInteger index)
    {
        CGFloat yValue = [data[index] floatValue];
        return [PNLineChartDataItem dataItemWithY:yValue];
    };
    
    self.lineChart.chartData = @[lineChartData];
    [self.lineChart strokeChart];
}

@end
